package com.sgb.kjwl.view.ui.activity.toBeReviewed;

import android.content.Context;
import android.content.Intent;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.LinearLayoutManager;
import android.widget.ImageView;
import android.widget.TextView;

import com.sgb.kjwl.AppActivity;
import com.sgb.kjwl.AppApplication;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ActivityReviewListBinding;
import com.sgb.kjwl.di.quotedprice.DaggerQuotedPriceComponent;
import com.swgk.core.base.di.AppComponent;
import com.swgk.core.recyclerview.adapter.AdapterOnItemClick;

import java.util.List;

import javax.inject.Inject;

public class ReviewListActivity extends AppActivity {


    @Inject
    ToBeReviewModel model;
    ActivityReviewListBinding binding;
    ReviewListAdapter adapter;
    private AppApplication myApp;

    public static void start(Context context, String companyNo) {
        Intent intent = new Intent();
        intent.putExtra("companyNo", companyNo);
        intent.setClass(context, ReviewListActivity.class);
        context.startActivity(intent);
    }

    @Override
    protected void setupActivityComponent(AppComponent appComponent) {
        super.setupActivityComponent(appComponent);
        DaggerToBeReviewComponent.builder().appComponent(appComponent)
                .toBeReviewModule(new ToBeReviewModule(this))
                .build().inject(this);
    }

    @Override
    protected void initView() {
        myApp = (AppApplication) getApplication();
        binding = DataBindingUtil.setContentView(this, R.layout.activity_review_list);
        binding.include.titleView.setText("新成员申请");
        binding.include.ivBack.setOnClickListener(this);
        adapter = new ReviewListAdapter(getActivity(), null);
        adapter.setOnItemClick(new AdapterOnItemClick<MemberApplyEntry>() {
            @Override
            public void onItemClick(MemberApplyEntry memberApplyEntry, int position) {

            }
        });
        adapter.setiIemChildClickListener(new ReviewListAdapter.ItemChildClick() {
            @Override
            public void onItemClick(MemberApplyEntry memberApplyEntry, ImageView statusImg, TextView textView, int position) {

            }
        });
        binding.recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
        binding.recyclerView.setAdapter(adapter);
    }

    @Override
    protected void init() {
        model.getMemberApplyList(getIntent().getStringExtra("companyNo"));
    }


    public void setDataList(List<MemberApplyEntry> dataList) {
        adapter.setDatas(dataList);
    }

    public void addSuccess(){

    }
}